//
//  MineAPIManager.m
//  Learn
//
//  Created by zyl_macbookpro on 2024/4/2.
//  Copyright © 2024 迟建国. All rights reserved.
//

#import "MineAPIManager.h"

@implementation MineAPIManager
+ (void)GetUserInformationWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_User_Info_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)GetMineSettingWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Mine_Set_Msg_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)ModiftyProtectEyesSettingWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Mine_Set_Msg_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)GetBookListWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_VIP_List_Url];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)GetMyOrderListWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Order_List_Url];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)CreateOrderListWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Create_Order_List_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)ModiftyUserInfoWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Modifty_UserInfo_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)GetAboutMsgWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock;
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_About_Url];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)upLoadHeadImageWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Upload_Url];
    UIImage *img = param[@"img"];
    [BaseRequest baseUpload:url parms:@{} imageList:@[img] cache:NO autoHideLoading:YES progress:^(NSProgress * _Nonnull downloadProgress) {
        
    } result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)getBookListWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Hearsay_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)getCustomQuestionListWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Question_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)getMessageListWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Message_List_Url];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}

+ (void)getMessageInfoWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Message_Info_Url];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)AddRequestFeedbackWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_Add_Feedback_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+(void)GetStudyLogListWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_StudyLogList_Url];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)GetMissionHistoryWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_MissionHistory_Url];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)ChangeClassWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_JoinClass_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
        if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
             NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
        }
    }];
}
+ (void)ChangePhoneNumberWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_ChangeMobile_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
       
        resultBlock(resultObject);
    }];
}
+ (void)ChangePwdWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_ResetPWD_Url];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
        NSDictionary *dic = (NSDictionary *)resultObject;
        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
+ (void)CheckVersionWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_checkVersion];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
        NSDictionary *dic = (NSDictionary *)resultObject;
        resultBlock(resultObject);
    }];
}
+ (void)GetVipInfoWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,KM_API_VIP_INFO_Url];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
         NSDictionary *dic = (NSDictionary *)resultObject;

        if ([dic[@"code"] intValue] != 1) {
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
            return;
        }
        resultBlock(resultObject);
    }];
}
@end
